package com.dhcc.DRGsHosp.facade.impl.assembler;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

import com.dhcc.DRGsHosp.core.domain.DRGs;
import com.dhcc.DRGsHosp.facade.dto.DRGsDTO;

public class DRGsAssembler {
	
	public static DRGsDTO  toDTO(DRGs  dRGs){
		if (dRGs == null) {
			return null;
		}
    	DRGsDTO result  = new DRGsDTO();
	    	result.setDrgCode (dRGs.getDrgCode());
     	    	result.setDrgDesc (dRGs.getDrgDesc());
     	    	result.setDrgWeight (dRGs.getDrgWeight());
     	    	result.setDrgLrm (dRGs.getDrgLrm());
     	    	result.setDrg (dRGs.getDrg());
     	    	result.setAdrgCode (dRGs.getAdrgCode());
     	    	result.setVerCode (dRGs.getVerCode());
     	    return result;
	 }
	
	public static List<DRGsDTO>  toDTOs(Collection<DRGs>  dRGss){
		if (dRGss == null) {
			return null;
		}
		List<DRGsDTO> results = new ArrayList<DRGsDTO>();
		for (DRGs each : dRGss) {
			results.add(toDTO(each));
		}
		return results;
	}
	
	 public static DRGs  toEntity(DRGsDTO  dRGsDTO){
	 	if (dRGsDTO == null) {
			return null;
		}
	 	DRGs result  = new DRGs();
        result.setDrgCode (dRGsDTO.getDrgCode());
         result.setDrgDesc (dRGsDTO.getDrgDesc());
         result.setDrgWeight (dRGsDTO.getDrgWeight());
         result.setDrgLrm (dRGsDTO.getDrgLrm());
         result.setDrg (dRGsDTO.getDrg());
         result.setAdrgCode (dRGsDTO.getAdrgCode());
         result.setVerCode (dRGsDTO.getVerCode());
 	  	return result;
	 }
	
	public static List<DRGs> toEntities(Collection<DRGsDTO> dRGsDTOs) {
		if (dRGsDTOs == null) {
			return null;
		}
		
		List<DRGs> results = new ArrayList<DRGs>();
		for (DRGsDTO each : dRGsDTOs) {
			results.add(toEntity(each));
		}
		return results;
	}
}
